// WorkerThread.cpp
//
#include "WorkerThread.h"

#include "VObjectGL.h"

using namespace IDS::IDEAS::OpenGLView;

// ------------------------------------------------------------------------------------------------
WorkerThread::WorkerThread()
:QRunnable(),
 targetObject(NULL),
 targetPrecision(0.0),
 running(false)
{
	setAutoDelete(false);
}

// ------------------------------------------------------------------------------------------------
WorkerThread::~WorkerThread()
{}

// ------------------------------------------------------------------------------------------------
void WorkerThread::setTask( VObjectGL *obj, double precision)
{
	targetObject    = obj;
	targetPrecision = precision;
	running         = true;
}

// ------------------------------------------------------------------------------------------------
void WorkerThread::run()
{
	if( targetObject )
	{
		try
		{
			targetObject->updateLOD( targetPrecision );
		}
		catch(...){}
	}
	running = false;
}